package it.blueocean.acanto.taglibrary.jsp.taglib.tags.utils;

import java.lang.reflect.Array;

public final class HashCodeUtil
{
	public static final int SEED = 23;

	private static final int fODD_PRIME_NUMBER = 37;

	public static int hash(int paramInt, boolean paramBoolean)
	{
		return (firstTerm(paramInt) + ((paramBoolean) ? 1 : 0));
	}

	public static int hash(int paramInt, char paramChar)
	{
		return (firstTerm(paramInt) + paramChar);
	}

	public static int hash(int paramInt1, int paramInt2)
	{
		return (firstTerm(paramInt1) + paramInt2);
	}

	public static int hash(int paramInt, long paramLong)
	{
		return (firstTerm(paramInt) + (int) (paramLong ^ paramLong >>> 32));
	}

	public static int hash(int paramInt, float paramFloat)
	{
		return hash(paramInt, Float.floatToIntBits(paramFloat));
	}

	public static int hash(int paramInt, double paramDouble)
	{
		return hash(paramInt, Double.doubleToLongBits(paramDouble));
	}

	public static int hash(int paramInt, Object paramObject)
	{
		int i = paramInt;
		if(paramObject == null)
		{
			i = hash(i, 0);
		}
		else if(!(isArray(paramObject)))
		{
			i = hash(i, paramObject.hashCode());
		}
		else
		{
			int j = Array.getLength(paramObject);
			for (int k = 0; k < j; ++k)
			{
				Object localObject = Array.get(paramObject, k);
				i = hash(i, localObject);
			}
		}
		return i;
	}

	private static int firstTerm(int paramInt)
	{
		return (37 * paramInt);
	}

	private static boolean isArray(Object paramObject)
	{
		return paramObject.getClass().isArray();
	}
}
